<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #app{
            margin: 10px;
            /* box-sizing: border-box; */
        }
        .input-box{
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 20px;
        }
        .input-box input{
            flex:1;
            height: 40px;
            border:none;
            outline: none;
            border-radius: 40px;
            background-color:antiquewhite;
            padding-left: 20px;
            box-sizing: border-box;

        }
        .input-box span{
            width: 60px;
            text-align: center;
            color: lightgreen;
        }
        .summary{
            display: flex;
            align-items: center;
            justify-content: space-around;
            margin: 20px 0;
        }
        .summary span{
            padding: 10px;
            box-sizing: border-box;
            background-color: lightgreen;
            font-size: 14px;
            flex-shrink: 0;
            border-radius: 20px;
        }

        .box .title{
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 20px;
        }

        .box .list .task{
            display: flex;
            justify-content: space-between;
            height: 50px;
            line-height: 50px;
            background-color: lightgreen;
            border-radius: 50px;
            padding: 0 20px;
            box-sizing: border-box;
            font-size: 18px;
            margin: 10px 0;
        }
        .box .list .task.unfinished{
            background-color: lightcoral;
        }
        .box .list .task>div>span{
            margin: 0 5px;
        }
        .box .list .empty{
            margin: 30px;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="input-box">
            <input type="text" placeholder="输入任务名称" v-model="taskName">
            <span @click="assTask">新增</span>
        </div>
        <div class="summary">
            <span>全部任务( {{tasklist.length}} )</span>
            <span>已完成任务( {{tasklist.length - unfinishCount}} )</span>
            <span>未完成任务( {{unfinishCount}} )</span>
        </div>
        <div class="box">
            <div class="title">任务列表</div>
            <div class="list">
                <div :class="{unfinished:item.status == false}" class="task" v-for="(item,index) in tasklist" :key="index">
                    <div>
                        <span>
                            <input type="checkbox" @click="changeStatus(item)" :checked="item.status">
                        </span>
                        <span> {{item.id}} </span>
                        <span> {{item.name}} </span>
                    </div>
                    <span @click="deleteTask(index)">删除</span>
                </div>
                <div v-show="tasklist.length == 0" class="empty">任务列表为空，请添加一个任务</div>
            </div>
        </div>
    </div>
    <script src="./vue-2.5.21.js"></script>
    <script src="./06-TodoList.js"></script>
</body>
</html>